﻿@model ShoppingCartSettingsModel

@{
    //page title
    ViewBag.Title = T("Admin.Configuration.Settings.ShoppingCart").Text;
    //active menu item (system name)
    Html.SetActiveMenuItemSystemName("Shopping cart settings");
}

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    <div class="content-header clearfix">
        <h1 class="pull-left">
            @T("Admin.Configuration.Settings.ShoppingCart")
        </h1>
        <div class="pull-right">
            <button type="submit" name="save" class="btn bg-blue">
                <i class="fa fa-floppy-o"></i>
                @T("Admin.Common.Save")
            </button>
        </div>
    </div>


    <div class="content">
        <div class="form-horizontal">
            @Html.Action("ProjectScopeConfiguration", "Setting")
            @Html.Action("Mode", "Setting")
            @Html.ValidationSummary(false)

            <div class="panel-group">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div class="form-group">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.ShowDiscountBox_OverrideForProject, model => model.ShowDiscountBox, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.ShowDiscountBox)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.ShowDiscountBox)
                                @Html.ValidationMessageFor(model => model.ShowDiscountBox)
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.ShowGiftCardBox_OverrideForProject, model => model.ShowGiftCardBox, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.ShowGiftCardBox)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.ShowGiftCardBox)
                                @Html.ValidationMessageFor(model => model.ShowGiftCardBox)
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.MiniShoppingCartEnabled_OverrideForProject, model => model.MiniShoppingCartEnabled, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.MiniShoppingCartEnabled)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.MiniShoppingCartEnabled)
                                @Html.ValidationMessageFor(model => model.MiniShoppingCartEnabled)
                            </div>
                        </div>
                        <div class="form-group advanced-setting" id="pnlMiniShoppingCartProductNumber">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.MiniShoppingCartProductNumber_OverrideForProject, model => model.MiniShoppingCartProductNumber, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.MiniShoppingCartProductNumber)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.MiniShoppingCartProductNumber)
                                @Html.ValidationMessageFor(model => model.MiniShoppingCartProductNumber)
                            </div>
                        </div>
                        <div class="form-group advanced-setting" id="pnlShowProductImagesInMiniShoppingCart">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.ShowProductImagesInMiniShoppingCart_OverrideForProject, model => model.ShowProductImagesInMiniShoppingCart, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.ShowProductImagesInMiniShoppingCart)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.ShowProductImagesInMiniShoppingCart)
                                @Html.ValidationMessageFor(model => model.ShowProductImagesInMiniShoppingCart)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.AllowCartItemEditing_OverrideForProject, model => model.AllowCartItemEditing, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.AllowCartItemEditing)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.AllowCartItemEditing)
                                @Html.ValidationMessageFor(model => model.AllowCartItemEditing)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.MaximumShoppingCartItems_OverrideForProject, model => model.MaximumShoppingCartItems, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.MaximumShoppingCartItems)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.MaximumShoppingCartItems)
                                @Html.ValidationMessageFor(model => model.MaximumShoppingCartItems)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.MaximumWishlistItems_OverrideForProject, model => model.MaximumWishlistItems, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.MaximumWishlistItems)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.MaximumWishlistItems)
                                @Html.ValidationMessageFor(model => model.MaximumWishlistItems)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.ShowProductImagesOnShoppingCart_OverrideForProject, model => model.ShowProductImagesOnShoppingCart, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.ShowProductImagesOnShoppingCart)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.ShowProductImagesOnShoppingCart)
                                @Html.ValidationMessageFor(model => model.ShowProductImagesOnShoppingCart)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.ShowProductImagesOnWishList_OverrideForProject, model => model.ShowProductImagesOnWishList, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.ShowProductImagesOnWishList)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.ShowProductImagesOnWishList)
                                @Html.ValidationMessageFor(model => model.ShowProductImagesOnWishList)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.EmailWishlistEnabled_OverrideForProject, model => model.EmailWishlistEnabled, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.EmailWishlistEnabled)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.EmailWishlistEnabled)
                                @Html.ValidationMessageFor(model => model.EmailWishlistEnabled)
                            </div>
                        </div>
                        <div class="form-group advanced-setting" id="pnlAllowAnonymousUsersToEmailWishlist">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.AllowAnonymousUsersToEmailWishlist_OverrideForProject, model => model.AllowAnonymousUsersToEmailWishlist, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.AllowAnonymousUsersToEmailWishlist)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.AllowAnonymousUsersToEmailWishlist)
                                @Html.ValidationMessageFor(model => model.AllowAnonymousUsersToEmailWishlist)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.AllowOutOfStockItemsToBeAddedToWishlist_OverrideForProject, model => model.AllowOutOfStockItemsToBeAddedToWishlist, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.AllowOutOfStockItemsToBeAddedToWishlist)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.AllowOutOfStockItemsToBeAddedToWishlist)
                                @Html.ValidationMessageFor(model => model.AllowOutOfStockItemsToBeAddedToWishlist)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.MoveItemsFromWishlistToCart_OverrideForProject, model => model.MoveItemsFromWishlistToCart, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.MoveItemsFromWishlistToCart)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.MoveItemsFromWishlistToCart)
                                @Html.ValidationMessageFor(model => model.MoveItemsFromWishlistToCart)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.DisplayCartAfterAddingProduct_OverrideForProject, model => model.DisplayCartAfterAddingProduct, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.DisplayCartAfterAddingProduct)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.DisplayCartAfterAddingProduct)
                                @Html.ValidationMessageFor(model => model.DisplayCartAfterAddingProduct)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.DisplayWishlistAfterAddingProduct_OverrideForProject, model => model.DisplayWishlistAfterAddingProduct, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.DisplayWishlistAfterAddingProduct)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.DisplayWishlistAfterAddingProduct)
                                @Html.ValidationMessageFor(model => model.DisplayWishlistAfterAddingProduct)
                            </div>
                        </div>
                        <div class="form-group advanced-setting">
                            <div class="col-md-3">
                                @Html.OverrideProjectCheckboxFor(model => model.CrossSellsNumber_OverrideForProject, model => model.CrossSellsNumber, Model.ActiveProjectScopeConfiguration)
                                @Html.SDFLabelFor(model => model.CrossSellsNumber)
                            </div>
                            <div class="col-md-9">
                                @Html.SDFEditorFor(model => model.CrossSellsNumber)
                                @Html.ValidationMessageFor(model => model.CrossSellsNumber)
                            </div>
                        </div>
                    </div>

                    <script type="text/javascript">
                        $(document).ready(function() {
                            $("#@Html.FieldIdFor(model => model.MiniShoppingCartEnabled)").click(toggleMiniShoppingCartEnabled);
                            $("#@Html.FieldIdFor(model => model.EmailWishlistEnabled)").click(toggleEmailWishlistEnabled);

                            toggleMiniShoppingCartEnabled();
                            toggleEmailWishlistEnabled();
                        });

                        function toggleMiniShoppingCartEnabled() {
                            if ($('#@Html.FieldIdFor(model => model.MiniShoppingCartEnabled)').is(':checked')) {
                                $('#pnlMiniShoppingCartProductNumber').show();
                                $('#pnlShowProductImagesInMiniShoppingCart').show();
                            } else {
                                $('#pnlMiniShoppingCartProductNumber').hide();
                                $('#pnlShowProductImagesInMiniShoppingCart').hide();
                            }
                        }

                        function toggleEmailWishlistEnabled() {
                            if ($('#@Html.FieldIdFor(model => model.EmailWishlistEnabled)').is(':checked')) {
                                $('#pnlAllowAnonymousUsersToEmailWishlist').show();
                            } else {
                                $('#pnlAllowAnonymousUsersToEmailWishlist').hide();
                            }
                        }

                    </script>
                </div>
            </div>
        </div>
    </div>
}